<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>ParseJSON</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="4">ParseJSON()</font></b></p>
<p><b>语法</b></p><blockquote>

Result = <font color="#006666"><b>ParseJSON</b></font>(#JSON, Input$ [, Flags])</blockquote>

</blockquote>
<b>概要</b><br><blockquote>



Parse JSON data from a string. The <a href="jsonvalue.html">JSONValue()</a> function can be 
used to access the contained JSON value(s) after parsing. 

 

</blockquote><p><b>参数</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>#JSON</i></td>
<td width="90%"> 
 
A number to identify the new JSON. 
<a href="../reference/purebasic_objects.html">#PB_Any</a> can be used to auto-generate this number. 

 

</td></tr>
<tr><td><i>Input$</i></td>
<td> 
 
The string containing the JSON data to parse. 

 

</td></tr>
<tr><td><i>Flags (optional)</i></td>
<td> 
 
If set to <font color="#924B72">#PB_JSON_NoCase</font>, the JSON data will be parsed case insensitive. 
The default is to be case sensitive. 

 

</td></tr>
</table>
</blockquote><p><b>返回值</b></p><blockquote>



Nonzero if the JSON data was parsed correctly, zero otherwise. If <font color="#924B72">#PB_Any</font> was used 
for the #JSON parameter then the generated number is returned on success. 

 

</blockquote><p><b>Remarks</b></p><blockquote>



In case of an error, the <a href="jsonerrormessage.html">JSONErrorMessage()</a>, <a href="jsonerrorline.html">JSONErrorLine()</a> and <a href="jsonerrorposition.html">JSONErrorPosition()</a> 
functions can be used to get more information about the error. 
<br>
<br>
To parse JSON data directly from a memory buffer, the <a href="catchjson.html">CatchJSON()</a> function can be used instead. 
<br>
<br>
JSON is a case sensitive data format. However, in some situations, such as deserializing 
structures with <a href="extractjsonstructure.html">ExtractJSONStructure()</a> or similar commands it may be useful to treat 
JSON objects as case insensitive. The <font color="#924B72">#PB_JSON_NoCase</font> flag causes all 
member related functions to treat keys in this object as case insensitive. 

 

</blockquote><p><b>示例</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">If</font></b> <font color="#006666">ParseJSON</font>(0, "[1, 2, 3, 4, 5]")    
    <b><font color="#006666">For</font></b> i = 0 <b><font color="#006666">To</font></b> <font color="#006666">JSONArraySize</font>(<font color="#006666">JSONValue</font>(0)) - 1
      <b><font color="#006666">Debug</font></b> <font color="#006666">GetJSONInteger</font>(<font color="#006666">GetJSONElement</font>(<font color="#006666">JSONValue</font>(0), i))
    <b><font color="#006666">Next</font></b> i
  <b><font color="#006666">Else</font></b>
<font color="#006666">    JSONErrorMessage</font>()
  <b><font color="#006666">EndIf</font></b>
</font></pre>

</blockquote><p><b>参阅</b></p><blockquote>

<a href="createjson.html">CreateJSON()</a>, <a href="catchjson.html">CatchJSON()</a>, <a href="loadjson.html">LoadJSON()</a>, <a href="jsonvalue.html">JSONValue()</a>, <a href="freejson.html">FreeJSON()</a>, 
<a href="jsonerrormessage.html">JSONErrorMessage()</a>, <a href="jsonerrorline.html">JSONErrorLine()</a>, <a href="jsonerrorposition.html">JSONErrorPosition()</a>, 
<a href="exportjson.html">ExportJSON()</a> 

</Blockquote><p><b>已支持操作系统 </b><Blockquote>所有</Blockquote></p><center>&lt;- <a href=nextjsonmember.html>NextJSONMember()</a> - <a href=index.html>Json Index</a> - <a href=removejsonelement.html>RemoveJSONElement()</a> -&gt;



</body></html>